package bpm.dao.impl.document;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;

import bpm.domain.document.Category;
import bpm.domain.document.Comment;
import bpm.domain.document.Field;
/**
 * 
 * @author ZhaoWangLong Sep 16, 2011
 *
 */
public class CommentRowMapper implements RowMapper {

	public Object mapRow(ResultSet rs, int i) throws SQLException {
		Comment comment=new Comment();
		comment.setCommentId(rs.getString("COMMENT_ID"));
		Category category=new Category();
		category.setId(rs.getInt("CATEGORY_ID"));
		category.setName(rs.getString("CATEGORY_NAME"));
		comment.setCategory(category);
		Field field=new Field();
		field.setKey(rs.getString("FIELD_KEY"));
		field.setName(rs.getString("FIELD_NAME"));
		comment.setField(field);
		comment.setRank(rs.getInt("RANK"));
		comment.setCreateTime(rs.getDate("CREATE_TIME"));
		comment.setDescription(rs.getString("DESCRIPTION"));
		return comment;
	}

}
